﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using App1AppHandler;
using Reborn_WorldServer.PendingClients;
using Reborn_WorldServer.TransferCharacters;
using Reborn_WorldServer.App1AppHandler;
using Reborn_WorldServer.PendingTells;
using System.Net.Sockets;
using Reborn_WorldServer.PendingClusterQuerys;

namespace Reborn_WorldServer
{
    static public class Managers
    {
        static public AppHandler2 GameHandler = new AppHandler2(); 
        static public LocalWorldsManager localWorldsManager = new LocalWorldsManager();
        static public PendingClientsManager pendingClientsManager = new PendingClientsManager();
        static public TransferCharacterManagerWS transferCharacterManager = new TransferCharacterManagerWS();
        static public CharacterManager characterManager = new CharacterManager();
        static public TellManagerWS tellManager = new TellManagerWS();
        static public PendingQueryManager pendingQueryManager = new PendingQueryManager();

        static public ServerSocketData socketPrimary;
        static public bool SendToPrimary(string xmlMessage)
        {
            try
            {
                byte[] byData = System.Text.Encoding.ASCII.GetBytes(xmlMessage + "\0");
                socketPrimary.socket.Send(byData);
                return true;
            }
            catch
            {
                return false;
            }
        }
        static public void BeginSendToPrimary(string xmlMessage)
        {
            try
            {
                byte[] byData = System.Text.Encoding.ASCII.GetBytes(xmlMessage + "\0");
                socketPrimary.socket.BeginSend(byData, 0, byData.Length, SocketFlags.None, null, null);
            }
            catch { }
        }


        public const string DBConnectionString = "Server=DOLEMITE;Initial Catalog=RPGRebornData;UID=sa;PWD=6vinuziy";
    }
}
